// get请求
const baseurl = ""
function ajaxget(url, val) {
  wx.request({
    url: baseurl + baseurl,
    data: data,
    header: {
      // "Content-Type":"application/json"
    },
    success: function (res) {
      console.log(res.data)
    },
    fail: function (err) {
      console.log(err)
    }

  })
}
// post请求
function ajaxpost(url, val) {
  wx.request({
    url: baseurl + baseurl,
    data: data,
    methdo: post,
    header: {
      // "Content-Type":"application/json"
    },
    success: function (res) {
      console.log(res.data)
    },
    fail: function (err) {
      console.log(err)
    }

  })
}
// 上传文件
function uploadFile(file, data) {
  wx.uploadFile({
    url: 'http://example.com/upload',
    filePath: file,
    name: 'file',
    formData: data,
    success: function (res) {
      console.log(res.data)
    },
    fail: function (err) {
      console.log(err)
    }

  })

}
// function test(val) {
//   console.log(val)
// }
module.exports.ajaxget = ajaxget
exports.ajaxpost = ajaxpost
exports.uploadFile = uploadFile
